Recording medium having recorded thereon coded information using plus and/or minus rounding of images

ABSTRACT

A computer-readable medium having stored thereon an image decoding program which, when executed by a computer, performs: storing a reference image which is a previously decoded image; receiving coded information including motion vector information and rounding method information specifying a rounding method used in synthesizing a prediction image; and synthesizing the prediction image by performing motion compensation using the motion vector information and the reference image; wherein the synthesizing a prediction image is performable using positive and negative rounding methods for interpolating intensity values of pixels; wherein the interpolation of intensity values of pixels uses a rounding method specified by the rounding method information; wherein the rounding method information is included in coded information of the currently decoded image; wherein the rounding method information specifies one of two values specifying a positive rounding method and a negative rounding method, respectively.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of application Ser. No. 12/342,808,filed Dec. 23, 2008 (now U.S. Pat. No. 7,676,100), which is acontinuation of application Ser. No. 11/770,900, filed Jun. 29, 2007(now U.S. Pat. No. 7,471,836), which is a continuation of applicationSer. No. 10/623,589, filed Jul. 22, 2003 (now U.S. Pat. No. 7,251,369),which is a continuation of application Ser. No. 09/513,688 filed Feb.25, 2000 (now U.S. Pat. No. 6,631,214), which is a continuation ofapplication Ser. No. 09/093,194, filed Jun. 8, 1998 (now U.S. Pat. No.6,295,376), the contents of which are hereby incorporated herein byreference in their entirety.

This application is also related to application Ser. No. 09/514,287,filed Feb. 28, 2000 (now U.S. Pat. No. 6,560,367); application Ser. No.09/516,207, filed Feb. 29, 2000 (now U.S. Pat. No. 6,529,632);application Ser. No. 09/516,245, filed Mar. 1, 2000 (now U.S. Pat. No.6,643,409); application Ser. No. 09/875,932, filed Jun. 8, 2001 (nowU.S. Pat. No. 6,574,371); application Ser. No. 09/875,930, filed Jun. 8,2001 (now U.S. Pat. No. 6,650,781); application Ser. No. 09/875,872,filed Jun. 8, 2001 (now U.S. Pat. No. 6,567,558); application Ser. No.09/875,929, filed Jun. 8, 2001 (now U.S. Pat. No. 6,584,227);application Ser. No. 09/875,928, filed Jun. 8, 2001 (now U.S. Pat. No.6,606,419); application Ser. No. 10/623,669, filed Jul. 22, 2003 (nowU.S. Pat. No. 6,909,809); application Ser. No. 10/623,531, filed Jul.22, 2003 (now U.S. Pat. No. 6,915,013); application Ser. No. 10/623,668,filed Jul. 22, 2003 (now U.S. Pat. No. 6,868,185); application Ser. No.10/623,506, filed Jul. 22, 2003 (now U.S. Pat. No. 6,876,769);application Ser. No. 10/902,042, filed Jul. 30, 2004 (now U.S. Pat. No.7,184,601); application Ser. No. 10/901,959, filed Jul. 30, 2004 (nowU.S. Pat. No. 7,200,274); application Ser. No. 10/901,960, filed Jul.30, 2004 (now U.S. Pat. No. 7,248,742); application Ser. No. 10/901,964,filed Jul. 30, 2004 (now U.S. Pat. No. 7,072,518); application Ser. No.10/902,040, filed Jul. 30, 2004 (now U.S. Pat. No. 7,233,704);application Ser. No. 10/902,041, filed Jul. 30, 2004 (now U.S. Pat. No.7,236,635); application Ser. No. 11/770,912, filed Jun. 29, 2007 (nowU.S. Pat. No. 7,471,837); application Ser. No. 11/770,923, filed Jun.29, 2007 (now U.S. Pat. No. 7,466,864); application Ser. No. 11/770,932,filed Jun. 29, 2007 (now U.S. Pat. No. 7,421,133); application Ser. No.11/770,937, filed Jun. 29, 2007 (now U.S. Pat. No. 7,424,161);application Ser. No. 11/770,953, filed Jun. 29, 2007 (now U.S. Pat. No.7,426,307); application Ser. No. 12/342,787, filed Dec. 23, 2008;application Ser. No. 12/342,884, filed Dec. 23, 2008; application Ser.No. 12/344,617, filed Dec. 29, 2008; application Ser. No. 12/344,619,filed Dec. 29, 2008; application Ser. No. 12/344,621, filed Dec. 29,2008; application Ser. No. 12/344,625, filed Dec. 29, 2008; applicationSer. No. 12/344,626, filed Dec. 29, 2008, all of which, like the presentapplication, are continuations of application Ser. No. 09/093,194, filedJun. 8, 1998 (now U.S. Pat. No. 6,295,376). This application relates toand claims priority from Japanese Patent Application No. 9-150656, filedon Jun. 9, 1997. The entirety of the contents and subject matter of allof the above is incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an image sequence coding and decodingmethod which performs interframe prediction using quantized values forchrominance or luminance intensity.

2. Related Art

In high efficiency coding of image sequences, interframe prediction(motion compensation) by utilizing the similarity of adjacent framesover time, is known to be a highly effective technique for datacompression. Today's most frequently used motion compensation method isblock matching with half pixel accuracy, which is used in internationalstandards H.263, MPEG1, and MPEG2. In this method, the image to be codedis segmented into blocks and the horizontal and vertical components ofthe motion vectors of these blocks are estimated as integral multiplesof half the distance between adjacent pixels. This process is describedusing the following equation:[Equation 1]P(x,y)=R(x+u _(i) ,y+v _(i)(x,y)εB _(i),0≦i<N  (1)

where P(x, y) and R(x, y) denote the sample values (luminance orchrominance intensity) of pixels located at coordinates (x, y) in thepredicted image P of the current frame and the reference image (decodedimage of a frame which has been encoded before the current frame) R,respectively. “x” and “y” are integers, and it is assumed that all thepixels are located at points where the coordinate values are integers.Additionally it is assumed that the sample values of the pixels arequantized to non-negative integers. N, Bi, and (ui, vi) denote thenumber of blocks in the image, the set of pixels included in the i-thblock of the image, and the motion vectors of the i-th block,respectively.

When the values for “ui” and “vi” are not integers, it is necessary tofind the intensity value at the point where no pixels actually exist inthe reference image. Currently, bilinear interpolation using theadjacent four pixels is the most frequently used method for thisprocess. This interpolation method is described using the followingequation:

$\begin{matrix}\left\lbrack {{Equation}\mspace{14mu} 2} \right\rbrack & \; \\{{R\left( {{x + \frac{p}{d}},{{y + \frac{q}{d}} = \left( {{\left( {d - q} \right)\left( {{\left( {d - p} \right){R\left( {x,y} \right)}} + {{pR}\left( {{x + 1},y} \right)}} \right)} + {q\left( {{\left( {d - p} \right){R\left( {x,{y + 1}} \right)}} + {pR}} \right)\left( {{x + 1},{y + 1}} \right)}} \right)}} \right)}//d^{2}} & (2)\end{matrix}$

where “d” is a positive integer, and “p” and “q” are smaller than “d”but not smaller than zero “0”. “//” denotes integer division whichrounds the result of normal division (division using real numbers) tothe nearest integer.

An example of the structure of an H.263 video encoder is shown inFIG. 1. As the coding algorithm, H.263 adopts a hybrid coding method(adaptive interframe/intraframe coding method) which is a combination ofblock matching and DCT (discrete cosine transform). A subtractor 102calculates the difference between the input image (current frame baseimage) 101 and the output image 113 (related later) of theinterframe/intraframe coding selector 119, and then outputs an errorimage 103. This error image is quantized in a quantizer 105 after beingconverted into DCT coefficients in a DCT converter 104 and then formsquantized DCT coefficients 106. These quantized DCT coefficients aretransmitted through the communication channel, while at the same timeused to synthesize the interframe predicted image in the encoder.

The procedure for synthesizing the predicted image is explained next.The above mentioned quantized DCT coefficients 106 forms thereconstructed error image 110 (same as the reconstructed error image onthe receive side) after passing through a dequantizer 108 and inverseDCT converter 109. This reconstructed error image and the output image113 of the interframe/intraframe coding selector 119 is added at theadder 111 and the decoded image 112 of the current frame (same image asthe decoded image of current frame reconstructed on the receiver side)is obtained. This image is stored in a frame memory 114 and delayed fora time equal to the frame interval. Accordingly, at the current point,the frame memory 114 outputs the decoded image 115 of the previousframe. This decoded image of the previous frame and the original image101 of the current frame are input to the block matching section 116 andblock matching is performed between these images. In the block matchingprocess, the original image of the current frame is segmented intomultiple blocks, and the predicted image 117 of the current frame issynthesized by extracting the section most resembling these blocks fromthe decoded image of the previous frame. In this process, it isnecessary to estimate the motion between the prior frame and the currentframe for each block. The motion vector for each block estimated in themotion estimation process is transmitted to the receiver side as motionvector data 120.

On the receiver side, the same prediction image as on the transmitterside is synthesized using the motion vector information and the decodingimage of the previous frame. The prediction image 117 is input alongwith a “0” signal 118 to the interframe/intraframe coding selector 119.This switch 119 selects interframe coding or intraframe coding byselecting either of these inputs. Interframe coding is performed whenthe prediction image 117 is selected (this case is shown in FIG. 2). Onthe other hand when the “0” signal is selected, intraframe coding isperformed since the input image itself is converted, to a DCTcoefficients and output to the communication channel.

In order for the receiver side to correctly reconstruct the coded image,the receiver must be informed whether intraframe coding or interframecoding was performed on the transmitter side. Consequently, anidentifier flag 121 is output to the communication circuit. Finally, anH.263 coded bitstream 123 is acquired by multiplexing the quantized DCTcoefficients, motion vectors, the and interframe/intraframe identifierflag information in a multiplexer 122.

The structure of a decoder 200 for receiving the coded bit stream outputfrom the encoder of FIG. 1 is shown in FIG. 2. The H.263 coded bitstream 217 that is received is demultiplexed into quantized DCTcoefficients 201, motion vector data 202, and an interframe/intraframeidentifier flag 203 in the demultiplexer 216. The quantized DCTcoefficients 201 become a decoded error image 206 after being processedby an inverse quantizer 204 and inverse DCT converter 205. This decodederror image is added to the output image 215 of theinterframe/intraframe coding selector 214 in an adder 207 and the sum ofthese images is output as the decoded image 208. The output of theinterframe/intraframe coding selector is switched according to theinterframe/intraframe identifier flag 203. A prediction image 212utilized when performing interframe encoding is synthesized in theprediction image synthesizer 211. In this synthesizer, the position ofthe blocks in the decoded image 210 of the prior frame stored in framememory 209 is shifted according to the motion vector data 202. On theother hand, for intraframe coding, the interframe/intraframe codingselector outputs the “0” signal 213 as is.

SUMMARY OF THE INVENTION

The image encoded by H.263 is comprised of a luminance plane (“Y” plane)containing luminance information, and two chrominance planes (“U” planeand “V” plane) containing chrominance information.

At this time, characteristically, when the image has 2m pixels in thehorizontal direction and 2n pixels in the vertical direction (“m” and“n” are positive integers), the Y plane has 2m pixels horizontally and2n pixels vertically, the U and V planes have m pixels horizontally andn pixels vertically.

The low resolution on the chrominance plane is due to the fact that thehuman visual system has a comparatively dull visual faculty with respectto spatial variations in chrominance. Having such image as an input,H.263 performs coding and decoding in block units referred to asmacroblocks.

The structure of a macroblock is shown in FIG. 3. The macroblock iscomprised of three blocks; a Y block, U block and V block. The size ofthe Y block 301 containing the luminance information is 16×16 pixels,and the size of the U block 302 and V block 303 containing thechrominance information is 8×8 pixels.

In H.263, half pixel accuracy block matching is applied to each block.Accordingly, when the estimated motion vector is defined as (u, v), uand v are both integral multiples of half the distance between pixels.In other words, ½ is used as the minimum unit. The configuration of theinterpolation method used for the intensity values (hereafter theintensity values for “luminance” and “chrominance” are called by thegeneral term “intensity value”) is shown in FIG. 4. When performing theinterpolation described in equation 2, the quotients of division arerounded off to the nearest integer, and further, when the quotient has ahalf integer value (i.e. 0.5 added to an integer), rounding off isperformed to the next integer in the direction away from zero. In otherwords, in FIG. 4, when the intensity values for 401, 402, 403, 404 arerespectively La, Lb, Lc, and Ld (La, Lb, Lc, and Ld are non-negativeintegers), the interpolated intensity values Ia, Ib, Ic, and Id (Ia, Ib,Ic, and Id are non-negative integers) at positions 405, 406, 407, 408are expressed by the following equation:

$\begin{matrix}{\left\lbrack {{Equation}{\mspace{11mu}\;}3} \right\rbrack\begin{matrix}\begin{matrix}{{Ia} = {Ib}} \\{{Ib} = \left\lbrack {\left( {{La} + {Lb} + 1} \right)/2} \right\rbrack}\end{matrix} \\\begin{matrix}{{Ic} = \left\lbrack {\left( {{La} + {Lc} + 1} \right)/2} \right\rbrack} \\{{Id} = \left\lbrack {\left( {{La} + {Lb} + {Lc} + {Ld} + 2} \right)/4} \right\rbrack}\end{matrix}\end{matrix}} & (3)\end{matrix}$

where “[ ]” denotes truncation to the nearest integer towards zero “0”(i.e. the fractional part is discarded). The expectation of the errorscaused by this rounding to integers is estimated as follows: It isassumed that the probability that the intensity value at positions 405,406, 407, and 408 of FIG. 4 is used is all 25 percent. When finding theintensity value Ia for position 405, the rounding error will clearly bezero “0”. Also, when finding the intensity value Ib for position 406,the error will be zero “0” when La+Lb is an even number, and when an oddnumber the error is ½. If the probability that La+Lb will be an evennumber and an odd number is both 50 percent, then the expectation forthe error will be 0×½+½×½=¼. Further, when finding the intensity valueIc for position 407, the expectation for the error is ¼ as for Ib. Whenfinding the intensity value Id for position 408, the error when theresidual of La+Lb+Lc+Ld divided by four are 0, 1, 2, and 3 arerespectively 0, −¼, ½, and ¼.

If we assume that the probability that the residual is 0, 1, 2, and 3 isall equal (i.e. 25 percent), the expectation for the error is0×¼−¼×¼+½×¼+¼×¼=⅛. As described above, assuming that the possibilitythat the intensity value at positions 405-408 being used are all equal,the final expectation for the error is 0×¼+¼×¼+¼×¼+⅛×¼= 5/32. Thisindicates that each time motion compensation is performed by means ofblock matching, an error of 5/32 occurs in the pixel intensity value.Generally in low rate coding, sufficient number of bits cannot be usedfor the encoding of the interframe error difference so that thequantized step size of the DCT coefficient is prone to be large.Accordingly, errors occurring due to motion compensation are correctedonly when it is very large. When interframe encoding is performedcontinuously without performing intraframe coding under suchenvironment, the errors tend to accumulate and cause bad effects on thereconstructed image.

Just as explained above, the number of pixels is about half (½) in boththe vertical and horizontal direction on the chrominance plane.Therefore, for the motion vectors of the U block and V block, half (½)the value of the motion vector for the Y block is used for the verticaland horizontal components. Since the horizontal and vertical componentsof the motion vector for the Y block motion vector are integralmultiples of ½, the motion vector components for the U and V blocks willappear as integral multiples of ¼ (quarter pixel accuracy) if ordinarydivision is implemented. However, due to the high computationalcomplexity of the intensity interpolation process for motion vectorswith quarter ¼ pixel accuracy, the motion vectors for U and V blocks arerounded to half ½ pixel accuracy in H.263.

The rounding method utilized in H.263 is as follows: According to thedefinition described above, (u, v) denotes the motion vector of themacroblock (which is equal to the motion vector for the Y block).Assuming that r is an integer and s is a non-negative integer smallerthan 4, u/2 can be rewritten as u/2=r+s/4. When s is 0 or 2, no roundingis required since u/2 is already an integral multiple of ½. However whens is equal to 1 or 3, the value of s is rounded to 2. By increasing thepossibility that s takes the value of 2 using this rounding method, thefiltering effect of motion compensation can be emphasized. When theprobability that the value of s prior to rounding is 0, 1, 2, and 3 areall percent, the probability that s will be 0 or 2 after rounding willrespectively be 25 percent and 75 percent. The above explained processrelated to the horizontal component u of the motion vector is alsoapplied to the vertical component v. Accordingly, in the U block and Vblock, the probability for using the intensity value of the 401 positionis ¼×¼= 1/16, and the probability for using the intensity value of the402 and 403 positions is both ¼×¾= 3/16, while the probability for usingthe intensity value of position 404 is ¾×¾= 9/16. By utilizing the samemethod as above, the expectation for the error of the intensity value is0× 1/16+¼× 3/16+¼× 3/16+⅛× 9/16= 21/128.

Just as explained above for the Y block, when interframe encoding iscontinuously performed, the problem of accumulated errors occurs. Asrelated above, for image sequence coding and decoding methods in whichinterframe prediction is performed and luminance or chrominanceintensity is quantized, the problem of accumulated rounding errorsoccurs. This rounding error is generated when the luminance orchrominance intensity value is quantized during the generation of theinterframe prediction image.

In view of the above problems, it is therefore an object of thisinvention, to improve the quality of the reconstructed image bypreventing error accumulation.

In order to achieve the above object, the accumulation of errors isprevented by limiting the occurrence of errors or performing anoperation to cancel out errors that have occurred.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing the layout of the H.263 image encoder.

FIG. 2 is a block diagram showing the layout of the H.263 image decoder.

FIG. 3 is a drawing showing the structure of the macro block.

FIG. 4 is a drawing showing the interpolation process of intensityvalues for block matching with half pixel accuracy.

FIG. 5 is a drawing showing a coded image sequence.

FIG. 6 is a block diagram showing a software image encoding device.

FIG. 7 is a block diagram showing a software image decoding device.

FIG. 8 is a flow chart showing an example of processing in the softwareimage encoding device.

FIG. 9 is a flow chart showing an example of the coding mode decisionprocessing for the software image encoding device.

FIG. 10 is a flow chart showing an example of motion estimation andmotion compensation processing in the software image encoding device.

FIG. 11 is a flow chart showing the processing in the software imagedecoding device.

FIG. 12 is a flow chart showing an example of motion compensationprocessing in the software image decoding device.

FIG. 13 is a drawing showing an example of a storage media on which anencoded bit stream generated by an encoding method that outputs bitstreams including I, P+ and P− frames is recorded.

FIG. 14 is a set of drawings showing specific examples of devices usingan encoding method where P+ and P− frames coexist.

FIG. 15 is a drawing showing an example of a storage media on which anencoded bit stream generated by an encoding method the outputs bitstreams including I, B, P+, and P− frames is recorded.

FIG. 16 is a block diagram showing an example of a block matching unitincluded in a device using an encoding method where P+ and P− framescoexist.

FIG. 17 is a block diagram showing the prediction image synthesizerincluded in a device for decoding bit streams encoded by an encodingmethod where P+ and P− frames coexist.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

First, in which circumstances the accumulated rounding errors asdescribed in the “Related Art” occur must be considered. An example ofan image sequences encoded by coding methods which can perform bothunidirectional prediction and bidirectional prediction such as inMPEG.1, MPEG.2 and H.263 is shown in FIG. 5.

An image 501 is a frame-coded by means of intraframe coding and isreferred to as an I frame. In contrast, images 503, 505, 507, 509 arecalled P frames and are coded by unidirectional interframe coding byusing the previous I or P frame as the reference image. Accordingly,when for instance encoding image 505, image 503 is used as the referenceimage and interframe prediction is performed. Images 502, 504, 506 and508 are called B frames and bidirectional interframe prediction isperformed utilizing the previous and subsequent I or P frame. The Bframe is characterized by not being used as a reference image wheninterframe prediction is performed. Since motion compensation is notperformed in I frames, the rounding error caused by motion compensationwill not occur. In contrast, not only is motion compensation performedin the P frames but the P frame is also used as a reference image byother P or B frames so that it may be a cause leading to accumulatedrounding errors. In the B frames on the other hand, motion compensationis performed so that the effect of accumulated rounding errors appearsin the reconstructed image. However, due to the fact that B frames arenot used as reference images, B frames cannot be a source of accumulatedrounding errors. Thus, if accumulated rounding errors can be preventedin the P frame, then the bad effects of rounding errors can bealleviated in the overall image sequence. In H.263 a frame for coding aP frame and a B frame exists and is called a PB frame (For instance,frames 503 and 504 can both be encoded as a PB frame). If the combinedtwo frames are viewed as separate frames, then the same principle asabove can be applied. In other words, if countermeasures are takenversus rounding errors for the P frame part within a PB frame, then theaccumulation of errors can be prevented.

Rounding errors occur during interpolation of intensity values when avalue obtained from normal division (division whose operation result isa real number) is a half (½) integer (0.5 added to an integer) and thisresult is then rounded up to the next integer in the direction away fromzero. For instance, when dividing by 4 to find an interpolated intensityvalue is performed, the rounding errors for the cases when the residualis 1 and 3 have equal absolute values but different signs. Consequently,the rounding errors caused by these two cases are canceled when theexpectation for the rounding errors is calculated (in more generalwords, when dividing by a positive integer d′ is performed, the roundingerrors caused by the cases when the residual is t and d′−t arecancelled). However, when the residual is 2, in other words when theresult of normal division is a half integer, the rounding error cannotbe canceled and leads to accumulated errors.

To solve this problem, a method that allows the usage of two roundingmethods can be used. The two rounding methods used here are: a roundingmethod that rounds half (½) integers away from zero (0); and a roundingmethod that rounds half (½) integers towards zero (0). By combining theusage of these two rounding methods, the rounding errors can becanceled. Hereafter, the rounding method that rounds the result ofnormal division to the nearest integer and rounds half integer valuesaway from 0 is called “positive rounding”. Additionally, the roundingmethod that rounds the result of normal division to the nearest integerand rounds half (½) integer values towards zero (0) is called “negativerounding”. The process of positive rounding used in block matching withhalf (½) pixel accuracy is shown in Equation 3. When negative roundingis used instead, this equation can be rewritten as shown below.

$\begin{matrix}{\left\lbrack {{Equation}{\mspace{11mu}\;}4} \right\rbrack\begin{matrix}\begin{matrix}{{Ia} = {Ib}} \\{{Ib} = \left\lbrack {\left( {{La} + {Lb}} \right)/2} \right\rbrack}\end{matrix} \\\begin{matrix}{{Ic} = \left\lbrack {\left( {{La} + {Lc}} \right)/2} \right\rbrack} \\{{Id} = \left\lbrack {\left( {{La} + {Lb} + {Lc} + {Ld} + 1} \right)/4} \right\rbrack}\end{matrix}\end{matrix}} & 4\end{matrix}$

Hereafter motion compensation methods that performs positive andnegative rounding for the synthesis of interframe prediction images arecalled “motion compensation using positive rounding” and “motioncompensation using negative rounding”, respectively. Furthermore, for Pframes which use block matching with half (½) pixel accuracy for motioncompensation, a frame that uses positive rounding is called a “P+ frame”and a frame that uses negative rounding is called a “P− frame” (underthis definition, the P frames in H.263 are all P+ frames). Theexpectation for the rounding errors in P+ and P− frames have equalabsolute values but different signs. Accordingly, the accumulation ofrounding errors can be prevented when P+ frames and P− frames arealternately located along the time axis.

In the example in FIG. 5, if the frames 503 and 507 are set as P+ framesand the frames 505 and 509 are set as P− frames, then this method can beimplemented. The alternate occurrence of P+ frames and P− frames leadsto the usage of a P+ frame and a P− frame in the bidirectionalprediction for B frames. Generally, the average of the forwardprediction image (i.e. the prediction image synthesized by using frame503 when frame 504 in FIG. 5 is being encoded) and the backwardprediction image (i.e. the prediction image synthesized by using frame505 when frame 504 in FIG. 5 is being encoded) is frequently used forsynthesizing the prediction image for B frames. This means that using aP+ frame (which has a positive value for the expectation of the roundingerror) and a P− frame (which has a negative value for the expectation ofthe rounding error) in bidirectional prediction for a B frame iseffective in canceling out the effects of rounding errors. Just asrelated above, the rounding process in the B frame will not be a causeof error accumulation. Accordingly, no problem will occur even if thesame rounding method is applied to all the B frames. For instance, noserious degradation of decoded images is caused even if motioncompensation using positive rounding is performed for all of the Bframes 502, 504, 506, and 508 in FIG. 5. Preferably only one type ofrounding is performed for a B frame, in order to simplify the B framedecoding process.

A block matching section 1600 of an image encoder according to the abovedescribed motion compensation method utilizing multiple rounding methodsis shown in FIG. 16. Numbers identical to those in other drawingsindicate the same part. By substituting the block matching section 116of FIG. 1 with 1600, multiple rounding methods can be used. Motionestimation processing between the input image 101 and the decoded imageof the previous frame is performed in a motion estimator 1601. As aresult, motion information 120 is output. This motion information isutilized in the synthesis of the prediction image in a prediction imagesynthesizer 1603.

A rounding method determination device 1602 determines whether to usepositive rounding or negative rounding as the rounding method for theframe currently being encoded. Information 1604 relating to the roundingmethod that was determined is input to the prediction image synthesizer1603. In this prediction image synthesizer 1603, a prediction image 117is synthesized and output based on the rounding method determined bymeans of information 1604. In the block matching section 116 in FIG. 1,there are no items equivalent to 1602, 1604 of FIG. 16, and theprediction image is synthesized only by positive rounding. Also, therounding method 1605 determined at the block matching section can beoutput, and this information can then be multiplexed into the bit streamand be transmitted.

A prediction image synthesizer 1700 of an image decoder which can decodebit streams generated by a coding method using multiple rounding methodsis shown in FIG. 17. Numbers identical to those in other drawingsindicate the same part. By substituting the prediction image synthesizer211 of FIG. 2 by 1700, multiple rounding methods can be used. In therounding method determination device 1701, the rounding methodappropriate for prediction image synthesis in the decoding process isdetermined. In order to carry out decoding correctly, the roundingmethod selected here must be the same as the rounding method that wasselected for encoding.

For instance the following rule can be shared between the encoder anddecoder: When the current frame is a P frame and the number of P frames(including the current frame) counted from the most recent I frame isodd, then the current frame is a P+ frame. When this number is even,then the current frame is a P− frame. If the rounding methoddetermination device on the encoding side (For instance, 1602 in FIG.16) and the rounding method determination device 1701 conform to thiscommon rule, then the images can correctly be decoded. The predictionimage is synthesized in the prediction image synthesizer 1703 usingmotion information 202, decoding image 210 of the prior frame, andinformation 1702 related to the rounding method determined as justdescribed. This prediction image 212 is output and then used for thesynthesis of the decoded image.

As an alternative to the above mentioned case, a case where theinformation related to the rounding method is multiplexed in thetransmitted bit stream can also be considered (such bit stream can begenerated at the encoder by outputting the information 1605 related tothe rounding method from the block matching section depicted in FIG.16). In such case, the rounding method determiner device 1701 is notused, and information 1704 related to the rounding method extracted fromthe encoded bit stream is used at the prediction image synthesizer 1703.

Besides the image encoder and the image decoder utilizing the customcircuits and custom chips of the conventional art as shown in FIG. 1 andFIG. 2, this invention can also be applied to software image encodersand software image decoders utilizing general-purpose processors. Asoftware image encoder 600 and a software image decoder 700 are shown inFIG. 6 and FIG. 7. In the software image encoder 600, an input image 601is first stored in the input frame memory 602 and the general-purposeprocessor 603 loads information from here and performs encoding. Theprogram for driving this general-purpose processor is loaded from astorage device 608 which can be a hard disk, floppy disk, etc. andstored in a program memory 604. This general purpose processor also usesa process memory 605 to perform the encoding. The encoding informationoutput by the general-purpose processor is temporarily stored in theoutput buffer 606 and then output as an encoded bit stream 607.

A flowchart for the encoding software (recording medium readable bycomputer) is shown in FIG. 8. The process starts in 801, and the value 0is assigned to variable N in 802. Next, in 803 and 804, the value 0 isassigned to N when the value for N is 100. N is a counter for the numberof frames. 1 is added for each one frame whose processing is complete,and values from 0 to 99 are allowed when performing coding. When thevalue for N is 0, the current frame is an I frame. When N is an oddnumber, the current frame is a P+ frame, and when an even number otherthan 0, the current frame is a P− frame. When the upper limit for thevalue of N is 99, it means that one I frame is coded after 99 P frames(P+ frames or P− frames) are coded. By always inserting one I frame in acertain number of coded frames, the following benefits can be obtained:(a) Error accumulation due to a mismatch between encoder and decoderprocessing can be prevented (for instance, a mismatch in the computationof DCT); and (b) The processing load for acquiring the reproduced imageof the target frame from the coded data (random access) is reduced. Theoptimal N value varies when the encoder performance or the environmentwhere the encoder is used are changed. It does not mean, therefore, thatthe value of N must always be 100.

The process for determining the rounding method and coding mode for eachframe is performed in 805 and the flowchart with details of thisoperation is shown in FIG. 9. First of all, whether N is a zero (0) ornot is checked in 901. If N is 0, then ‘I’ is output as distinctioninformation of the prediction mode, to the output buffer in 902. Thismeans that the image to be coded is will be coded as an I frame. Here,“output to the output buffer” means that after being stored in theoutput buffer, the information is output to an external device as aportion of the coded bit stream. When N is not 0, then whether N is anodd or even number is identified in 904. When N is an odd number, ‘+’ isoutput to the output buffer as the distinction information for therounding method in 905, and the image to be coded will be coded as a P+frame. On the other hand, when N is an even number, ‘−’ is output to theoutput buffer as the distinction information for the rounding method in906, and the image to be coded will be coded as a P− frame.

The process again returns to FIG. 8, where after determining the codingmode in 805, the input image is stored in the frame memory A in 806. Theframe memory A referred to here signifies a portion of the memory zone(for instance, the memory zone maintained in the memory of 605 in FIG.6) of the software encoder. In 807, it is checked whether the framecurrently being coded is an I frame. When not identified as an I frame,motion estimation and motion compensation is performed in 808.

The flowchart in FIG. 10 shows details of this process performed in 808.First of all, in 1001, motion estimation is performed between the imagesstored in frame memories A and B (just as written in the final part ofthis paragraph, the decoded image of the prior frame is stored in framememory B). The motion vector for each block is found, and this motionvector is sent to the output buffer. Next, in 1002, whether or not thecurrent frame is a P+ frame is checked. When the current frame is a P+frame, the prediction image is synthesized in 1003 utilizing positiverounding and this prediction image is stored in frame memory C. On theother hand, when the current frame is a P− frame, the prediction imageis synthesized in 1004 utilizing negative rounding and this predictionimage is stored in the frame memory C. Next, in 1005, the differentialimage between frame memories A and C is found and stored in frame memoryA.

Here, the process again returns to FIG. 8. Prior to starting theprocessing in 809, the input image is stored in frame memory A when thecurrent frame is an I frame, and the differential image between theinput image and the prediction image is stored in frame memory A whenthe current frame is a P frame (P+ or P− frame). In 809, DCT is appliedto the image stored in frame memory A, and the DCT coefficientscalculated here are sent to the output buffer after being quantized. In810, inverse quantization is performed to the quantized DCT coefficientsand inverse DCT is applied. The image obtained by applying inverse DCTis stored in frame memory B. Next in 811, it is checked again whetherthe current frame is an I frame. When the current frame is not an Iframe, the images stored in frame memory B and C are added and theresult is stored in frame memory B. The coding process of a frame endshere, and the image stored in frame memory B before going into 813 isthe reconstructed image of this frame (this image is identical with theone obtained at the decoding side). In 813, it is checked whether theframe whose coding has just finished is the final frame in the sequence.If this is true, the coding process ends. If this frame is not the finalframe, 1 is added to N in 814, and the process again returns to 803 andthe coding process for the next frame starts.

A software decoder 700 is shown in FIG. 7. After the coded bit stream701 is temporarily stored in the input buffer 702, this bit stream isthen loaded into the general-purpose processor 703. The program fordriving this general-purpose processor is loaded from a storage device708 which can be a hard disk, floppy disk, etc. and stored in a programmemory 704. This general-purpose processor also uses a process memory605 to perform the decoding. The decoded image obtained by the decodingprocess is temporarily stored in the output frame memory 706 and thensent out as the output image 707.

A flowchart of the decoding software for the software decoder 700 shownin FIG. 7 is shown in FIG. 11. The process starts in 1101, and it ischecked in 1102 whether input information is present. If there is noinput information, the decoding process ends in 1103. When inputinformation is present, distinction information of the prediction modeis input in 1104. The word “input” used here means that the informationstored in the input buffer (for instance 702 of FIG. 7) is loaded by thegeneral-purpose processor. In 1105, it is checked whether the encodingmode distinction information is “I”. When not “I”, the distinctioninformation for the rounding method is input and synthesis of theinterframe prediction image is performed in 1107.

A flowchart showing details of the operation in 1107 is shown in FIG.12. In 1201, a motion vector is input for each block. Then, in 1202, itis checked whether the distinction information for the rounding methodloaded in 1106 is a “+”. When this information is “+”, the framecurrently being decoded is a P+ frame. In this case, the predictionimage is synthesized using positive rounding in 1203, and the predictionimage is stored in frame memory D. Here, frame memory D signifies aportion of the memory zone of the software decoder (for instance, thismemory zone is obtained in the processing memory 705 in FIG. 7). Whenthe distinction information of the rounding method is not “+”, thecurrent frame being decoded is a P− frame. The prediction image issynthesized using negative rounding in 1204 and this prediction image isstored in frame memory D. At this point, if a P+ frame is decoded as aP− frame due to some type of error, or conversely if a P− frame isdecoded as a P+ frame, the correct prediction image is not synthesizedin the decoder and the quality of the decoded image deteriorates.

After synthesizing the prediction image, the operation returns to FIG.11 and the quantized DCT coefficients is input in 1108. Inversequantization and inverse DCT is then applied to these coefficients andthe resulting image is stored in frame memory E. In 1109, it is checkedagain whether the frame currently being decoded is an I frame. If thecurrent frame is not an I frame, images stored in frame memory D and Eare added in 1110 and the resulting sum image is stored in frame memoryE. The image stored in frame memory E before starting the process in1111 is the reconstructed image. This image stored in frame memory E isoutput to the output frame memory (for instance, 706 in FIG. 7) in 1111,and then output from the decoder as the reconstructed image. Thedecoding process for a frame is completed here and the process for thenext frame starts by returning to 1102.

When a software based on the flowchart shown in FIGS. 8-12 is run in thesoftware image encoders or decoders, the same effect as when customcircuits and custom chips are utilized are obtained.

A storage media (recording media) with the bit stream generated by thesoftware encoder 601 of FIG. 6 being recorded is shown in FIG. 13. It isassumed that the algorithms shown in the flowcharts of FIGS. 8-10 isused in the software encoder. Digital information is recordedconcentrically on a recording disk 1301 capable of recording digitalinformation (for instance magnetic disks, optical disk, etc.). A portion1302 of the information recorded on this digital disk includes:prediction mode distinction information 1303, 1305, 1308, 1311, and1314; rounding method distinction information 1306, 1309, 1312, and1315; and motion vector and DCT coefficient information 1304, 1307,1310, 1313, and 1316. Information representing ‘I’ is recorded in 1303,‘P’ is recorded in 1305, 1308, 1311, and 1314, ‘+’ is recorded in 1306,and 1312, and ‘−’ is recorded in 1309, and 1315. In this case, ‘I’ and‘+’ can be represented by a single bit of zero (0), and ‘P’ and ‘−’ canbe represented by a single bit of one (1). Using this representation,the decoder can correctly interpret the recorded information and thecorrect reconstructed image is synthesized. By storing a coded bitstream in a storage media using the method described above, theaccumulation of rounding errors is prevented when the bit stream is readand decoded.

A storage media with the bit stream of the coded data of the imagesequence shown in FIG. 5 being recorded is shown in FIG. 15. Therecorded bit stream includes information related to P+, P−, and Bframes. In the same way as in 1301 of FIG. 13, digital information isrecorded concentrically on a record disk 1501 capable for recordingdigital information (for instance, magnetic disks, optical disks, etc.).A portion 1502 of the digital information recorded on this digital diskincludes: prediction mode distinction information 1503, 1505, 1508,1510, and 1513; rounding method distinction information 1506, and 1512;and motion vector and DCT coefficient information 1504, 1507, 1509,1511, and 1514. Information representing ‘I’ is recorded in 1503, ‘P’ isrecorded in 1505, and 1510, ‘B’ is recorded in 1508, and 1513, ‘+’ isrecorded in 1505, and ‘−’ is recorded in 1511. In this case, ‘I’, ‘P’and ‘B’ can be represented respectively by two bit values 00, 01, and10, and ‘+’ and is ‘−’ can be represented respectively by one bit values0 and 1. Using this representation, the decoder can correctly interpretthe recorded information and the correct reconstructed is synthesized.

In FIG. 15, information related to frame 501 (I frame) in FIG. 5 is 1503and 1504, information related to 502 (B frame) is 1508 and 1509,information related to frame 503 (P+ frame) is 1505 and 1507,information related to frame 504 (B frame) is 1513 and 1514, andinformation related to frame 505 (P− frame) is 1510 and 1512. Whencoding image sequences are coded using B frames, the transmission orderand display order of frames are usually different. This is because theprevious and subsequent reference images need to be coded before theprediction image for the B frame is synthesized. Consequently, in spiteof the fact that the frame 502 is displayed before frame 503,information related to frame 503 is transmitted before informationrelated to frame 502.

As described above, there is no need to use multiple rounding methodsfor B frames since motion compensation in B frames do not causeaccumulation of rounding errors. Therefore, as shown in this example,information that specifies rounding methods (e.g. ‘+’ and ‘−’) is nottransmitted for B frames. Thus for instance, even if only positiverounding is applied to B frames, the problem of accumulated roundingerrors does not occur. By storing coded bit streams containinginformation related to B frames in a storage media in the way describedabove, the occurrence of accumulated rounding errors can be preventedwhen this bit stream is read and decoded.

Specific examples of coders and decoders using the coding methoddescribed in this specification is shown in FIG. 14. The image codingand decoding method can be utilized by installing image coding anddecoding software into a computer 1401. This software is recorded insome kind of storage media (CD-ROM, floppy disk, hard disk, etc.) 1412,loaded into a computer and then used. Additionally, the computer can beused as an image communication terminal by connecting the computer to acommunication lines. It is also possible to install the decoding methoddescribed in this specification into a player device 1403 that reads anddecodes the coded bit stream recorded in a storage media 1402. In thiscase, the reconstructed image signal can be displayed on a televisionmonitor 1404. The device 1403 can be used only for reading the coded bitstream, and in this case, the decoding device can be installed in thetelevision monitor 1404. It is well known that digital data transmissioncan be realized using satellites and terrestrial waves. A decodingdevice can also be installed in a television receiver 1405 capable ofreceiving such digital transmissions. Also, a decoding device can alsobe installed inside a set top box 1409 connected to asatellite/terrestrial wave antenna, or a cable 1408 of a cabletelevision system, so that the reconstructed images can be displayed ona television monitor 1410. In this case, the decoding device can beincorporated in the television monitor rather than in the set top box,as in the case of 1404. The layout of a digital satellite broadcastsystem is shown in 1413, 1414 and 1415. The video information in thecoded bit stream is transmitted from a broadcast station 1413 to acommunication or broadcast satellite 1414. The satellite receives thisinformation, sends it to a home 1415 having equipment for receivingsatellite broadcast programs, and the video information is reconstructedand displayed in this home using devices such as a television receiveror a set top box.

Digital image communication using mobile terminals 1406 has recentlyattracted considerable attention, due to the fact that imagecommunication at very low bit rates has become possible. Digitalportable terminals can be categorized in the following three types: atransceiver having both an encoder and decoder; a transmitter havingonly an encoder; and a receiver having only a decoder.

An encoding device can be installed in a video camera recorder 1407. Thecamera can also be used just for capturing the video signal and thissignal can be supplied to a custom encoder 1411. All of the devices orsystems shown in this drawing can be equipped with the coding and/ordecoding method described in this specification. By using this codingand/or decoding method in these devices or systems, images of higherquality compared with those images obtained using conventionaltechnologies can be obtained. The following variations are clearlyincluded within the scope of this invention.

(i) A prerequisite of the above described principle was the use of blockmatching as a motion compensation method. However, this invention isfurther capable of being applied to all image sequence coding anddecoding methods in which motion compensation is performed by taking avalue for the vertical and horizontal components of the pixel motionvector that is other than an integer multiple of the sampling period inthe vertical and horizontal directions of the pixel, and then finding byinterpolation, the intensity value of a position where the sample valueis not present. Thus for instance, the global motion compensation listedin Japanese Patent Application No. 8-60572 published as Japanese PatentApplication Laid-Open No. 9-252470 and the warping prediction listed inJapanese Patent Application No. 8-249601 published as Japanese PatentApplication Laid-Open No. 10-98729 are applicable to the method of thisinvention.

(ii) The description of the invention only mentioned the case where avalue integral multiple of ½was taken for the horizontal and verticalcomponents of the motion vector. However, this invention is alsogenerally applicable to methods in which integral multiples of 1/d (d isa positive integer and also an even number) are allowed for thehorizontal and vertical components of the motion vector. However, when dbecomes large, the divisor for division in bilinear interpolation(square of “d”, see Equation 2) also becomes large, so that in contrast,the probability of results from normal division reaching a value of 0.5become low. Accordingly, when performing only positive rounding, theabsolute value of the expectation for rounding errors becomes small andthe bad effects caused by accumulated errors become less conspicuous.Also applicable to the method of this invention, is a motioncompensation method where for instance, the d value is variable, bothpositive rounding and negative rounding are used when d is smaller thana fixed value, and only positive rounding or only negative rounding isused when the value of d is larger than a fixed value.

(iii) As mentioned in the “Related Art” section, when DCT is utilized asan error coding method, the adverse effects from accumulated roundingerrors are prone to appear when the quantized step size of the DCTcoefficient is large. However a method is also applicable to theinvention, in which, when the quantization step size of DCT coefficientsis larger than a threshold value then both positive rounding andnegative rounding are used. When the quantization step size of the DCTcoefficients is smaller than the threshold value then only positiverounding or only negative rounding is used.

(iv) In cases where error accumulations occur on the luminance plane andcases where error accumulations occur on the chrominance plane, the badeffects on the reconstructed images are generally more serious in thecase of error accumulations on the chrominance plane. This is due to thefact that rather than cases where the image darkens or lightensslightly, cases where overall changes in the image color happen are moreconspicuous. However, a method is also applicable to this invention inwhich both positive rounding and negative rounding are used for thechrominance signal, and only positive rounding or negative rounding isused for the luminance signal.

As described in the “Related Art” section, ¼ pixel accuracy motionvectors obtained by halving the ½ pixel accuracy motion vectors arerounded to ½ pixel accuracy in H.263. However by adding certain changesto this method, the absolute expectation value for rounding errors canbe reduced. In H.263 that was mentioned in the related art, a valuewhich is half the horizontal or vertical components of the motion vectorfor the luminance plane is expressed as r+s/4 (r is an integer, s is aninteger less than 4 and not smaller than 0), and when s is 1 or 3, arounding operation is performed to obtain a 2. This operation can bechanged as follows: When s is 1, a rounding operation is performed toobtain a zero “0”, and when s is 3 a 1 is be added to r to make s a “0”.By performing these operations, the number of times that the intensityvalues at positions 406-408 in FIG. 4 is definitely reduced (probabilitythat horizontal and vertical components of motion vector will be aninteger become high) so that the absolute expectation value for therounding error becomes small. However, even if the size of the erroroccurring in this method can be limited, the accumulation of errorscannot be completely prevented.

(v) The invention described in this specification is applicable to amethod that obtains the final interframe prediction image by averagingthe prediction images obtained by different motion compensation methods.For example, in the method described in Japanese Patent Application No.8-3616 published as Japanese Patent Application Laid-Open No. 9-200763,interframe prediction images obtained by the following two methods areaveraged: block matching in which a motion vector is assigned to each16×16 pixel block; and block matching in which a motion vector isassigned to each 8×8 pixel blocks. In this method, rounding is alsoperformed when calculating the average of the two prediction images.When only positive rounding is continuously performed in this averagingoperation, a new type of rounding error accumulates. This problem can besolved by using multiple rounding methods for this averaging operation.In this method, negative rounding is performed in the averagingoperation when positive rounding is performed in block matching.Conversely, positive rounding is used for the averaging when negativerounding is used for block matching. By using different rounding methodsfor averaging and block matching, the rounding errors from two differentsources is cancelled within the same frame.

(vi) When utilizing a method that alternately locates P+ frames and P−frames along the time axis, the encoder or the decoder needs todetermine whether the currently processed P frame is a P+ frame or a P−frame. The following is an example of such identification method: Acounter counts the number of P frames after the most recently coded ordecoded I frame, and the current P frame is a P+ frame when the numberis odd, and a P− frame when the number is even (this method is referredto as an implicit scheme). There is also a method for instance, thatwrites into the header section of the coded image information,information to identify whether the currently coded P frame at theencoder is a P+ frame or a P− frame (this method is referred to as anexplicit scheme). Compared with the implicit method, this method is wellable to withstand transmission errors, since there is no need to countthe number of P frames.

Additionally, the explicit method has the following advantages: Asdescribed in the “Related Art” section, past encoding standards (such asMPEG-1 or MPEG-2) use only positive rounding for motion compensation.This means for instance that the motion estimation/motion compensationdevices (for example equivalent to 106 in FIG. 1) for MPEG-1/MPEG-2 onthe market are not compatible with coding methods that use both P+frames and P− frames. It is assumed that there is a decoder which candecode bit streams generated by a coding method that uses P+ frames andP− frames. In this case if the decoder is based on the above mentionedimplicit method, then it will be difficult to develop an encoder thatgenerates bit streams that can be correctly decoded by the abovementioned decoder, using the above mentioned motionestimation/compensation device for MPEG-1/MPEG-2.

However, if the decoder is based on the above mentioned explicit method,this problem can be solved. An encoder using an MFEG-1/MPEG-2 motionestimation/motion compensation device can continuously send P+ frames,by continuously writing rounding method distinction informationindicating positive rounding into the frame information header. Whenthis is performed, a decoder based on the explicit method can correctlydecode the bit stream generated by this encoder. Of course, it should bemore likely in such case that the accumulation of rounding errorsoccurs, since only P+ frames are present. However, error accumulation isnot a serious problem in cases where the encoder uses only small valuesas the quantization step size for the DCT coefficients (an example forsuch coders is a custom encoder used only for high rate coding). Inaddition to this interoperability between past standards, the explicitmethod further have the following advantages: (a) the equipment cost forhigh rate custom encoders and coders not prone to rounding erroraccumulation due to frequent insertion of I frames can be reduced byinstalling only positive or negative rounding as the pixel valuerounding method for motion compensation; and (b) the above encoders notprone to rounding error accumulation have the advantage in that there isno need to decide whether to code the current frame as a P+ or P− frame,and the processing is simplified.

(vii) The invention described in this specification is applicable tocoding and decoding methods that applies filtering accompanying roundingto the interframe prediction images. For instance, in the internationalstandard H.261 for image sequence coding, a low-pass filter (called a“loop filter”) is applied to block signals whose motion vectors are notzero (0) in interframe prediction images. Also, in H.263, filters can beused to smooth out discontinuities on block boundaries (blockingartifacts). All of these filters perform weighted averaging to pixelintensity values and rounding is then performed on the averagedintensity values. Even for these cases, selective use of positiverounding and negative rounding is effective for preventing erroraccumulation.

(viii) Besides I P+ P− P+ P− . . . , various methods for mixing P+frames and P− frames such as I P+ P+ P− P− P+ P+ . . . , or I P+ P− P−P+ P+ . . . are applicable to the method of this invention. Forinstance, using a random number generator that outputs 0 and 1 both at aprobability of 50 percent, the encoder can code a P+ and P− frame whenthe output is 0 and 1, respectively. In any case, the less thedifference in probability that P+ frames and P− frames occur in acertain period of time, the less the rounding error accumulation isprone to occur. Further, when the encoder, is allowed to mix P+framesand P− frames by an arbitrary method, the encoder and decoder mustoperate based on the explicit method and not with the implicit methoddescribed above. Accordingly, the explicit method is superior whenviewed from the perspective of allowing flexibility configuration forthe encoder and decoder.

(ix) The invention described in this specification does not limit thepixel value interpolation method to bilinear interpolation.Interpolation methods for intensity values can generally be described bythe following equation:

$\begin{matrix}\left\lbrack {{Equation}\mspace{14mu} 5} \right\rbrack & \; \\{{R\left( {{x + r},{y + s}} \right)} = {T\left( {\sum\limits_{j = {- x}}^{x}{\sum\limits_{j = {- x}}^{x}{{h\left( {{r - j},{s - k}} \right)}{R\left( {{x + j},{y + k}} \right)}}}} \right)}} & (5)\end{matrix}$where, r and s are real numbers, h(r, s) is a function for interpolatingthe real numbers, and T(z) is a function for rounding the real number z.The definitions of R (x, y), x, and y are the same as in Equation 4.

Motion compensation utilizing positive rounding is performed when T (z)is a function representing positive rounding, and motion compensationutilizing negative rounding is performed when the function representingnegative rounding. This invention is applicable to interpolation methodsthat can be described using Equation 5. For instance, bilinearinterpolation can be described by defining h(r, s) as shown below.

$\begin{matrix}\left\lbrack {{Equation}\mspace{14mu} 6} \right\rbrack & \; \\\begin{matrix}{{{h\left( {r,s} \right)} = {\left( {1 - {r}} \right)\left( {1 - {s}} \right)}},} & {{0 \leq {r} \leq 1},{0 \leq {s} \leq 1},} \\{0,} & {{otherwise}.}\end{matrix} & (6)\end{matrix}$

However, if for instance h(r,s) is defined as shown below,

$\begin{matrix}\left\lbrack {{Equation}\mspace{14mu} 7} \right\rbrack & \; \\\begin{matrix}{{{h\left( {r,s} \right)} = {1 - {r} - {s}}},} & {{0 \leq {{r} + {s}} \leq 1},{{rs} < 0},} \\{{1 - {r}},} & {{{r} \geq {s}},{{r} \leq 1},{{rs} \geq 0},} \\{{1 - {s}},} & {{{s} > {r}},{{s} \leq 1},{{rs} > 0},} \\{0,} & {{otherwise}.}\end{matrix} & (7)\end{matrix}$

then an interpolation method different from bilinear interpolation isimplemented but the invention is still applicable.

(x) The invention described in this specification does not limit thecoding method for error images to DCT (discrete cosine transform). Forinstance, wavelet transform (for example, N. Antonioni, et. al, “ImageCoding Using Wavelet Transform” IEEE Trans. Image Processing, vol. 1,no. 2, April 1992) and Walsh-Hadamard transform (for example, A. N.Netravalli and B. G. Haskell, “Digital Pictures”, Plenum Press, 1998)are also applicable to this invention.

1. A computer-readable medium having stored thereon an image decodingprogram which, when executed by a computer, performs: storing areference image which is a previously decoded image; receiving codedinformation including motion vector information and rounding methodinformation specifying a rounding method used in synthesizing aprediction image of a currently decoded image; and synthesizing theprediction image by performing motion compensation using the motionvector information and the reference image; wherein the synthesizing aprediction image is performable using a positive rounding method and anegative rounding method for interpolating intensity values of pixels;wherein the interpolation of intensity values of pixels is performedusing a rounding method specified by the rounding method information;wherein the rounding method information is included in coded informationof the currently decoded image; wherein the rounding method informationspecifies one of two values; and wherein one of the two values specifiesa positive rounding method, and another one of the two values specifiesa negative rounding method.